﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;

namespace FYPHP
{
    public partial class prelayout1 : System.Web.UI.UserControl
    {
        SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["fyphp"].ConnectionString);

        protected void Page_Load(object sender, EventArgs e)
        {
            SqlCommand cmdProduct;
            SqlDataReader dtrProduct;
            conn.Open();

            cmdProduct = new SqlCommand("SELECT * FROM Products p, Users u WHERE p.u_id=u.u_id AND u.u_id=@id", conn);
            cmdProduct.Parameters.AddWithValue("@id", Session["id"]);
            dtrProduct = cmdProduct.ExecuteReader();

            ItemList.DataSource = dtrProduct;
            ItemList.DataBind();

            dtrProduct.Close();
            conn.Close();
        }

        public string getBgColor()
        {
            return "#" + Request.QueryString["c"];
        }

        public string getFont()
        {
            return Request.QueryString["f"];
        }
    }
}